package org.dromara.system.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.dromara.system.domain.PayOrder;
import org.dromara.system.domain.vo.PayOrderVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.system.domain.vo.chart.AccountMoneyVo;

import java.util.List;
import java.util.Map;

/**
 * 订单Mapper接口
 *
 * @author Gavino
 * @date 2024-10-22
 */
public interface PayOrderMapper extends BaseMapperPlus<PayOrder, PayOrderVo> {

    @Select("SELECT status, COUNT(*) AS count " +
        "FROM pay_order " +
        "WHERE customer_email = #{customerEmail} " +
        "AND create_time > #{createTime} " +
        "AND app_id = #{appId} " +
        "AND order_id != #{orderId} " +
        "GROUP BY status")
    List<Map<String, Object>> selectCountByCustomerEmail(
        @Param("customerEmail") String customerEmail,
        @Param("createTime") String createTime,
        @Param("appId") Long appId,
        @Param("orderId") Long orderId);

}
